package org.ecloud.oauth.client.config;

import java.util.ArrayList;
import java.util.List;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;

/** 
 * IP-配置
 */
@Configuration
@ConfigurationProperties("authorization")
public class AuthorizationConfig {

	public static final String REQUEST_TYPE_HTTPCLIENT = "httpclient";
	public static final String REQUEST_TYPE_FEIGNCLIENT = "feignclient";
	
	/*
	  enable: false
	  request-type: feignclient
	  gateway-service-id: dev-zuul
	  access-token-verify-url: /ecloud/oauth2/authentication/verify
	  access-token-verify-url-full: http://gw.bfsip.com/ecloud/oauth2/authentication/verify 
	  ignoreUrls:
	*/
	
	private boolean enable = true;
	/**
	 * requestType:请求类型
	 */
	private String requestType = REQUEST_TYPE_FEIGNCLIENT;
	/**
	 * requestType:请求类型
	 */
	private String requestMethod = HttpMethod.GET.name();
	/**
	 * gatewayServiceId:网关服务ID-feignclient方式请求使用
	 */
	private String gatewayServiceId;
	/**
	 * accessTokenVerifyUrl:令牌服务地址-feignclient方式请求使用
	 */
	private String accessTokenVerifyUrl;
	/**
	 * accessTokenVerifyUrlFull:令牌服务完整地址-httpclient方式请求使用
	 */
	private String accessTokenVerifyUrlFull;
	/**
	 * contextUserUrl:用户上下文服务地址-feignclient方式请求使用
	 */
	private String contextUserUrl;
	/**
	 * contextUserUrlFull:用户上下文服务完整地址-httpclient方式请求使用
	 */
	private String contextUserUrlFull;
	/**
	 * contextOrgUrl:部门上下文服务地址-feignclient方式请求使用
	 */
	private String contextOrgUrl;
	/**
	 * contextOrgUrlFull:部门上下文服务完整地址-httpclient方式请求使用
	 */
	private String contextOrgUrlFull;
	/**
	 * contextPositionUrl:岗位上下文服务地址-feignclient方式请求使用
	 */
	private String contextPositionUrl;
	/**
	 * contextPositionUrlFull:岗位上下文服务完整地址-httpclient方式请求使用
	 */
	private String contextPositionUrlFull;
	/**
	 * ignoreUrls:无需令牌即可访问的地址
	 */
	private final List<String> ignoreUrls = new ArrayList<String>();
	
	public boolean isEnable() {
		return enable;
	}
	public void setEnable(boolean enable) {
		this.enable = enable;
	}
	public String getRequestType() {
		return requestType;
	}
	public void setRequestType(String requestType) {
		this.requestType = requestType;
	}
	public String getRequestMethod() {
		return requestMethod;
	}
	public void setRequestMethod(String requestMethod) {
		this.requestMethod = requestMethod;
	}
	public String getGatewayServiceId() {
		return gatewayServiceId;
	}
	public void setGatewayServiceId(String gatewayServiceId) {
		this.gatewayServiceId = gatewayServiceId;
	}
	public String getAccessTokenVerifyUrl() {
		return accessTokenVerifyUrl;
	}
	public void setAccessTokenVerifyUrl(String accessTokenVerifyUrl) {
		this.accessTokenVerifyUrl = accessTokenVerifyUrl;
	}
	public String getAccessTokenVerifyUrlFull() {
		return accessTokenVerifyUrlFull;
	}
	public void setAccessTokenVerifyUrlFull(String accessTokenVerifyUrlFull) {
		this.accessTokenVerifyUrlFull = accessTokenVerifyUrlFull;
	}
	public String getContextUserUrl() {
		return contextUserUrl;
	}
	public void setContextUserUrl(String contextUserUrl) {
		this.contextUserUrl = contextUserUrl;
	}
	public String getContextUserUrlFull() {
		return contextUserUrlFull;
	}
	public void setContextUserUrlFull(String contextUserUrlFull) {
		this.contextUserUrlFull = contextUserUrlFull;
	}
	public String getContextOrgUrl() {
		return contextOrgUrl;
	}
	public void setContextOrgUrl(String contextOrgUrl) {
		this.contextOrgUrl = contextOrgUrl;
	}
	public String getContextOrgUrlFull() {
		return contextOrgUrlFull;
	}
	public void setContextOrgUrlFull(String contextOrgUrlFull) {
		this.contextOrgUrlFull = contextOrgUrlFull;
	}
	public String getContextPositionUrl() {
		return contextPositionUrl;
	}
	public void setContextPositionUrl(String contextPositionUrl) {
		this.contextPositionUrl = contextPositionUrl;
	}
	public String getContextPositionUrlFull() {
		return contextPositionUrlFull;
	}
	public void setContextPositionUrlFull(String contextPositionUrlFull) {
		this.contextPositionUrlFull = contextPositionUrlFull;
	}
	public List<String> getIgnoreUrls() {
		return ignoreUrls;
	}
	
}
